/**
 * @author LKQ
 * @date 2022/1/7 9:56
 * @description
 */
public class Solution2 {
    public static void main(String[] args) {
        Solution2 solution2 = new Solution2();
        System.out.println(solution2.maxDepth("1+(2*3)/(2-1)"));
    }
    public int maxDepth(String s) {
        int depth = 0,  right = 0, ans = 0;
        while (right <  s.length()) {
            if (s.charAt(right) == '(') {
                depth++;
            }else if (s.charAt(right) == ')') {
                ans = Math.max(depth, ans);
                depth = depth - 1;
            }
            right++;
        }
        return ans;
    }
}
